#include "meta/variant.hh"
#include <iostream>
using std::cerr;

struct foo
{
	foo() { cerr << "ctor\n"; }
	~foo() { cerr << "dtor\n"; }
	foo(foo const&) { cerr << "copy ctor\n"; }
	foo(foo     &&) { cerr << "move ctor\n"; }
	auto& operator = (foo const&) { cerr << "copy asgn\n"; return *this; }
	auto& operator = (foo     &&) { cerr << "move asgn\n"; return *this; }
};

int main()
{
	using va = meta::variant<int, double, foo>;
	va v(3);
	foo f;
	v = f;
	v = std::move(f);
	double x = 3.2;
	v = x;
	cerr << v.strict_get<double>() << "\n";

	v = foo{};
	va b = v;
	va c = std::move(v);
	cerr << v.strict_get<int>() << "\n";
}

/* output:
 
	ctor
	copy ctor
	move asgn
	dtor
	3.2
	ctor
	move ctor
	dtor
	copy ctor
	move ctor
	terminate called after throwing an instance of 'meta::bad_cast'

*/

